#pragma once

#include <openssl/crypto.h>
#include <openssl/evp.h>

namespace auth
{
    # define SHA_DIGEST_LENGTH 20

    class BigNumber;
    class Sha1Hash
    {
    public:

        Sha1Hash();
        ~Sha1Hash();
        void UpdateBigNumbers(BigNumber* bn0, ...);
        void UpdateData(const unsigned char* dta, int len);
        void UpdateData(const std::string& str);
        void Initialize();
        void Finalize();
        unsigned char* GetDigest(void) { return mDigest; };
        int GetLength(void) { return SHA_DIGEST_LENGTH; };

    private:
        EVP_MD_CTX* ctx_ = nullptr;
        const EVP_MD* md_ = nullptr;
        unsigned char mDigest[SHA_DIGEST_LENGTH] = {0};
    };

}